
package com.shop.cloud.mall.admin.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shop.cloud.common.core.constant.CommonConstants;
import com.shop.cloud.mall.common.constant.MallConstants;
import com.shop.cloud.mall.common.entity.ShopDeposit;
import com.shop.cloud.mall.admin.mapper.ShopDepositMapper;
import com.shop.cloud.mall.admin.service.ShopDepositService;
import org.springframework.boot.autoconfigure.klock.annotation.Klock;
import org.springframework.boot.autoconfigure.klock.model.LockTimeoutStrategy;
import org.springframework.stereotype.Service;

/**
 * 店铺保证金
 *
 * @author
 * @date 2023-11-28 16:00:01
 */
@Service
public class ShopDepositServiceImpl extends ServiceImpl<ShopDepositMapper, ShopDeposit> implements ShopDepositService {

    @Override
    @Klock(name = "notifyShopDeposit", keys = {"#shopDeposit.getShopId()"}, lockTimeoutStrategy = LockTimeoutStrategy.FAIL_FAST)
    public void notifyShopDeposit(ShopDeposit shopDeposit) {
        shopDeposit.setStatus(MallConstants.SHOP_DEPOSIT_STATUS_1);
        shopDeposit.setIsPay(CommonConstants.YES);
        baseMapper.updateById(shopDeposit);
    }
}
